 {{include file="../tools/jquery_validator2.htm"}}
<div class="userbox">
  <h2>用户中心</h2>
  <form name="category" id="category" method="post">
    <div class="left userstore">
      <table>
        <tr>
          <td colspan="2" class="nameorange" >找回密码</td>
        </tr>
        
        <tr>
          <td colspan="2">请输入您的Email!</td>
        </tr>
        <tr>
          <td width="172">Email：</td>
          <td><input type="text"  name="email"  value="" class="email"/></td>
        </tr>
        
      </table>
      <div class="icobtn">
      	<input type="hidden"  name="c_id" value="{{$c_id}}"/>
        <input class="next" type="button"  onclick="steps()"/>
      </div>
    </div>
  </form>
   {{if !$no_style}}
  <!--left end--> 

  {{include file="./user_act_right.htm"}} 
  <!--right end--> 
  {{/if}}
  
</div>
<script>

  $(function(){
	  
	 
	 $('#category').validate(
	  {
	   
	 
	   rules: {
		email: {
		  required: true,
		  email:true,
		  ajaxCheck:{act:'is_register',field:'email'}
		 }
		
	  },
	
	  messages: {   
		   email: {       
			email: "Email格式错误"  ,
			ajaxCheck:'Email不存在！'   
		   }
   		}
	,
	success: function(element) {
				element
				.text('OK!').addClass('valid')
				.closest('.control-group').removeClass('error').addClass('success');
  	 }
	 });
		 
  })
  
  function steps(idx){
	  if( $('#category').valid())
	  {
		  var email = $(".email").val();
	   	  var data = "act=reset_passwd&email="+email;
		  Main.AJAX(sep+"/ajax.php",data,sendPasswdRes);
	  }
  }
  function sendPasswdRes(res){
	  var res = Code.trim(res);
	  if(res=='1')
	  {
		 alert("系统已将您的密码信息发送到您的邮箱，请及时查看!");
		 if('{{$no_style}}'=='')
		 {
		 	location.href = "./"; 
		 }
		  
	  }
	  else
	  {
		 alert("系统繁忙，请稍后重试!");  
		 if('{{$no_style}}'=='')
		 {
		 	location.href = "./"; 
		 }
	  }
  }
 
  </script>